package jgl.vajra.kingkong.part.vehicle.model;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import jgl.vajra.kingkong.bean.AdditionalRequirementsBean;
import jgl.vajra.kingkong.bean.CouponAvailableBean;
import jgl.vajra.kingkong.bean.MarketPriceBean;
import jgl.vajra.kingkong.part.vehicle.contract.ConfirmOrderContract;
import jgl.vajra.kingkong.utils.RandomUtils;
import jgl.vajra.kingkong.widget.manager.RxJavaHttpManager;
import jgl.vajra.kingkong.widget.manager.retrofit.RetrofitJsonManager;
import jgl.vajra.kingkong.widget.retrofithelper.utils.AEACCoder;

public class ConfirmOrderModel extends ConfirmOrderContract.Model{

    @Override
    public Observable<String> getRandomOrderNumber() {
        return RetrofitJsonManager.getInstance().getApiService().getRandomOrderNumber(AEACCoder.encrypt(RandomUtils.getRandom())).compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<String> getPlaceOrderData(Map<String, Object> map, String authorization) {
        return RetrofitJsonManager.getInstance().getApiService().getPlaceOrderData(map,authorization)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<MarketPriceBean> getMarketPriceData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getMarketPriceData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<List<AdditionalRequirementsBean>> getAdditionalRequirementsData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getAdditionalRequirementsData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<List<CouponAvailableBean>> getCouponsAvailableData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getCouponsAvailableData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }
}
